import http from '@/utils/http'

/**
 * @description 获取订单详情
 * @returns promise
 */
export const reqOrderDetail = () => {
  return http.get('/order/trade')
}

/**
 * @description 获取订单详情收获地址
 * @returns 返回promise
 */
export const reqOrderAddress = () => {
  return http.get('/userAddress/getOrderAddress')
}

/**
 * @description 立即购买商品接口
 * @param {Object} params {goodsId,商品Id blessing 祝福语}
 * @returns 返回promise
 */
export const reqBuyGoods = ({ goodsId, ...data }) => {
  return http.get(`/order/buy/${goodsId}`, data)
}

/**
 * @description 微信预支付订单
 * @returns pormise
 */
export const reqSubmitOrder = (data) => {
  return http.post('/order/submitOrder', data)
}

/**
 * @description 获取微信预支付信息
 * @param {*} orderNo
 * @returns promise
 */
export const reqPrePayinfo = (orderNo) => {
  return http.get(`/webChat/createJsapi/${orderNo}`)
}

/**
 * @description 获取微信订单支付状态
 * @param {*} orderNo 订单号
 * returns Promsie
 */
export const reqPayStatus = (orderNo) => {
  return http.get(`/webChat/queryPayStatus/${orderNo}`)
}

//
export const reqGetOrderList = (page, limit) => {
  return http.get(`/order/order/${page}/${limit}`)
}
